package com.alibaba.citrus.ots.sales.plan.functions.salesplan;

import com.alibaba.citrus.ots.common.util.SpringContextUtil;
import com.alibaba.citrus.ots.sales.plan.repository.SalesPlanLineRepository;
import com.alibaba.citrus.ots.sales.plan.sdo.SalesPlanLineSDO;
import lombok.Getter;
import lombok.Setter;

public class SalesPlanLineEntity {
    @Getter
    @Setter
    private SalesPlanLineSDO salesPlanLineSDO;

    private static SalesPlanLineRepository salesPlanLineRepository;

    static {
        salesPlanLineRepository = SpringContextUtil.getBean(SalesPlanLineRepository.class);
    }

    public static SalesPlanLineEntity of(SalesPlanLineSDO salesPlanLineSDO) {
        SalesPlanLineEntity entity = new SalesPlanLineEntity();
        entity.setSalesPlanLineSDO(salesPlanLineSDO);
        return entity;
    }

    public String doCreate() {
        return salesPlanLineRepository.save(salesPlanLineSDO);
    }

    public Integer doEdit() {

        return salesPlanLineRepository.edit(salesPlanLineSDO);
    }

    public Integer doDelete() {
        return salesPlanLineRepository.delete(salesPlanLineSDO);
    }
}
